//
//  MeatShopGivingListViewController.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/19.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "MeatShopGivingListViewController.h"
#import "GivingTableViewCell.h"
#import "MeatOrderBox.h"


@interface MeatShopGivingListViewController ()

@end

@implementation MeatShopGivingListViewController


- (void)setupUI{
    
    {
        self.baseNavView.navTitleLabel.text = @"赠送列表";
        self.baseNavView.navTitleLabel.textColor = KWhiteColor;
        
        [self.baseNavView.leftNavBtn setImage:[UIImage imageNamed:@"nav_white"] forState:UIControlStateNormal];
        
        UIImage *image = [UIImage imageNamed:@"meat_question_nav"];
        self.baseNavView.layer.contents =  (__bridge id)image.CGImage;
    }
}

- (void)setupLayout{
    
}

#pragma mark - networking methods
#pragma mark - response methods
#pragma mark - public methods

#pragma mark - tableview.delegate methods

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    NSLog(@"点击tableView");
    
}


#pragma mark - tableview.datascource methods

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 3;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return 1;
}


- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 0;
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
    
    return [UIView new];
}

- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
    return 10;
}


- (nullable UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
    
    return  [UIView new];
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    GivingTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"GivingTableViewCell"];
    
    @weakify(self);
    cell.dealShopListBlock = ^{
        @strongify(self);
        MeatOrderBox *box = [[MeatOrderBox alloc] init];
        [box showView];
    };
    
    cell.dealFallbackBlock = ^{
        @strongify(self);
        
        [[AlertAction sharedInstance] showAlertWithTitle:nil message:@"您确定要撤回本次赠送吗？" confirmBtnTitle:@"确定" confirmBlock:^{
            // [self clearLoginAccount];
        } cancelBlock:nil];
        
    };
    return cell;
}

#pragma mark - setter methods

#pragma mark - getter methods

- (void)registerTableViewCell
{
    self.tableView.rowHeight = 186;
    self.tableView.height = KScreenHeight - TJ_NavBarHeight -34;
    self.tableView.mj_y = TJ_NavBarHeight +34;
    self.tableView.separatorColor = mIconLineColor;
    [self.tableView registerClass:[GivingTableViewCell class] forCellReuseIdentifier:@"GivingTableViewCell"];
    
}



@end
